package com.itheima.controller;

import com.itheima.common.constant.MessageConstant;
import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.common.entity.Result;
import com.itheima.pojo.Order;
import com.itheima.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("backendOrderController")
@Slf4j
@RequestMapping("/order")
public class OrderController {
@Autowired
    OrderService orderService;
@PostMapping("/findPage")
PageResult getPage(@RequestBody QueryPageBean queryPageBean){
    log.info("分页查询检查项：{}", queryPageBean);
    PageResult pageResult=orderService.getPageResult(queryPageBean);
    return  pageResult;
}
    @PostMapping("/update")
    Result updateOrder(@RequestBody Order order){

        log.info("修改预约：{}", order);
        orderService.updateOrder(order);
        return new Result(true, MessageConstant.ORDERSETTING_SUCCESS);

    }
}
